package com.act.utils;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class DataResult {

    private Integer code;

    private String message;

    private Object data;

    private boolean success;



    public static  DataResult  success(Integer code){
        return new DataResult(code,null,null,true);
    }

    public static  DataResult success(String msg){
        return new DataResult(200,msg,null,true);
    }

    public static  DataResult success(String msg,Object data){
        return new DataResult(200,msg,data,true);
    }

    public static DataResult success(boolean isSuccess,String msg){
        return new DataResult(200,msg,null,isSuccess);
    }




    public static DataResult fail(Integer code){
        return new DataResult(code,"fail",null,false);
    }

    public static DataResult fail(String msg){
        return new DataResult(201,msg,null,false);
    }

    public static DataResult fail(String msg,Object data){
        return new DataResult(201,msg,data,false);
    }


}
